package com.le.dub.controller;


import com.le.dub.common.Response;
import com.le.dub.conf.UserUtil;
import com.le.dub.service.IOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author guole
 * @created 2024/7/6
 */
@RestController
@RequestMapping("/app/order")
@Slf4j
public class UserOrderController {



    @Resource
    private IOrderService orderService;

    /**
     * 创建支付订单
     *
     * @return
     */
    @PostMapping("/createOrder")
    Response createOrder(HttpServletRequest request,Integer goodId) {
        Long userId = UserUtil.getUserId(request);
        return Response.success(orderService.createOrder(goodId, userId));
    }


}
